home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 July / CHIP Turkiye Temmuz 2000.iso / prog / share / 38 / 38.exe / PRESIZER.DOC < prev    next >
Text File  |  2000-02-20  |  43KB  |  843 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                         Partition Resizer v. 1.3.3
  10.             ==========================
  11.                            (c) Zeleps 1994-2000
  12.                            ====================
  13.  
  14.  
  15.         Program's Manual and Technical Information
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. This file contains important information about the working and usage of
  27. Partition Resizer. Please read it carefully before using Partition Resizer.
  28. You MUST read README.1ST before running Partition Resizer.
  29.  
  30. DISCLAIMER:
  31. This program is freeware. You may freely copy it and distribute it,as long as
  32. it remains unchanged and it is distributed with its original documents files.
  33. The author is not responsible for any consequence of the use or missuse of
  34. this program. Using this program is completely at your own responsibility.
  35.  
  36. 1- What is Partition Resizer
  37.  
  38.    1.1 Why you need Partition Resizer
  39.    1.2 How does it work?
  40.    1.3 Is it safe?
  41.    1.4 Changes made to the previous version
  42.  
  43. 2- Working with Partition Resizer
  44.  
  45.    2.1 Safety precautions
  46.    2.2 Running the program: What does what
  47.  
  48. 3- Technical matters
  49.  
  50.    3.1 The partition system
  51.    3.2 The DOS (FAT16 and FAT12 only) filesystem structure
  52.    3.3 The Windows FAT32 filesystem structure
  53.  
  54. 4- Partitioning Techniques
  55.  
  56.    4.1 Deciding what you want
  57.    4.2 Merging many small partitions into a larger one
  58.    4.3 Splitting a partition in two
  59.    4.4 Playing with partitions' sizes and positions
  60.  
  61. 5- Credits and addresses
  62.  
  63.                 -------||-------
  64.  
  65. 1- What is Partition Resizer
  66.  
  67.    1.1 Why you need Partition Resizer
  68.  
  69. OK, this is simple: if you have a disk partition (or more), and you want to
  70. change its size or position for any particular reason whatsoever, you have
  71. 3 options:
  72.  
  73. a) Backup everything, use FDISK to delete the partition, re-create the
  74. partition and restore the data.
  75.  
  76. b) Pay $60 to buy a program that you will use 3 times in your life ($20 per
  77. use)
  78.  
  79. c) Use Partition Resizer
  80.  
  81. Always remember: This program does not intend to replace FDISK. It's rather
  82. complementary to it. You will still need FDISK if you want to create and
  83. delete partitions. Partition Resizer processes only existing partitions.
  84. Also, Partition Resizer does not convert FAT16 (older DOS partitions) into
  85. FAT32. Windows 98 provides a tool that does this conversion.
  86.  
  87.  
  88.    1.2 How does it work?
  89.  
  90. Well, this is the tricky part. The details are described in section 3, but
  91. I'll try to make a start from here. I assume that everybody understands the
  92. importance of partitioning. I also assume that most of you understand how
  93. partitioning is achieved. For those who don't, here it is:
  94.  
  95. Partitioning is just a marking of territories on the physical disk's surface.
  96. At the first sector of the disk (sector 1, head 0, cylinder 0) resides an
  97. executable code block, which looks for the bootable partition, and runs
  98. it's boot sector code. That sector contains the information needed to
  99. divide the disk space into partitions. Later on, the boot sector (which is
  100. created by the OS's format utility) loads the OS Kernel (in DOS's case it
  101. loads the IO.SYS and the MSDOS.SYS), which continues the job by loading
  102. the information of all the partition structure into memory.
  103.  
  104. Partition Resizer does two things: When moving, apart from moving the data,
  105. it changes the information contained in the partition structure. When
  106. resizing, it changes the file system's data, which is contained in the
  107. boot sector and the FAT area. Both partition and FAT FS structures are
  108. explained at section 3.
  109.  
  110.  
  111.    1.3 Is it safe?
  112.  
  113. A great deal of changes has been done to the resizing engine for version
  114. 1.3.0. The program has been known to work fine in most cases, but I've had
  115. two e-mails reporting data loss. Both cases were caused by a bug that is now
  116. corrected. Of course there has been lots of testing from my part, and from
  117. many users that used the program in their systems, so the probability for
  118. more critical bugs is highly unlikely. In case you find a problem, please
  119. inform me ASAP. In order to avoid trouble, you should backup the most
  120. valuable data in your disk, those that cannot be replaced. If something
  121. happens, you'll only have to reinstall what's lost.
  122.  
  123. Most of the partition combinations this program has been tested with are
  124. combinations created with DOS's (or Windows') FDISK, or compliant to it. If
  125. you have created a partition structure which is not compatible with DOS, the
  126. program will most probably encounter problems and refuse to work with the
  127. offending disk in order to protect your data. The typical DOS partition
  128. structure is described later on in this document (section 3).
  129.  
  130. The program utilises a special recovery mechanism that allows resumption of
  131. the resizing or moving process even if it is interrupted by a reboot (most
  132. probably due to power failure). Without this recovery mechanism, if the
  133. program was interrupted during the resizing or moving process, it would be
  134. impossible to access the partition's data again. This program stores every
  135. single step, so it always knows what the last action was. For speed and
  136. safety reasons I use the CMOS's bytes 1,3 and 5 (the alarm bytes) to store
  137. the step counter number. Because the contents of the CMOS are preserved even
  138. when the power is off, the program can always find the last step and continue
  139. its work like nothing happened. If you don't believe it, test it.
  140.  
  141. There is one problem I do not prevent: Bad sectors. In case your disk has
  142. bad sectors, the program will not run, in order to protect your data. It will
  143. make a surface scan before it starts, but if you are certain that your disk
  144. is free of defects, you may skip it. It would be better if you had your disk
  145. surface scanned with a commercial program (like Norton Disk Doctor or
  146. Windows' ScanDisk) before you run Partition Resizer.
  147.  
  148. And note this: The program can be *really* dangerous, if you don't follow
  149. ALL precautions described in the README.1ST file. Please read it carefully
  150. before using the program.
  151.  
  152.  
  153.    1.4 Changes made to the previous version
  154.  
  155. -Minor documentation update
  156. -Miscalculation of MaxSize for FAT32 partitions with cluster size>=8K
  157.  corrected
  158.  
  159.  
  160. 2- Working with Partition Resizer
  161.  
  162.    2.1 Safety Precautions
  163.  
  164. As with every program that messes with your data, you should be extra
  165. careful. It is not difficult to make a mistake that will cost you valuable
  166. data. So, you MUST follow carefully the instructions contained in the
  167. file README.1ST, in order to ensure data safety. It would be a good idea
  168. to print TROUBLE.DOC file in order to have it available when something
  169. wrong happens.
  170.  
  171.  
  172.    2.2 Running the program: What does what
  173.  
  174. The program will first look for the disk characteristics, it will scan the
  175. partition information, and it will identify and check all the DOS partitions
  176. of the disk. After some basic checks, it will continue with the main menu
  177. of the program. Here you have 4 choices.
  178.  
  179. The first is resizing/moving a DOS partition or an extended partition. This
  180. option will resize a partition in order to make free space for a new
  181. partition to be created. It will also grow a partition if there is
  182. unallocated space available and the cluster size is big enough. You can also
  183. move the partition in the empty space. This way you will be able to change
  184. the order of the partitions in the disk. You can also resize extended
  185. partitions.
  186.  
  187. The second option is used to change a FAT16 partition's cluster size. This
  188. will help you to make a small new partition able to grow up to any size you
  189. want. This option should be used ONLY on empty and formatted partitions,
  190. since it deletes all the data inside the partition.
  191.  
  192. The third option will show you detailed information for every partition on
  193. the disk. This may sometimes help you find out which partition you want to
  194. move or resize.
  195.  
  196. The last option will exit the program, and if you made any changes to the
  197. partition structure it will immediately reboot the machine, so that the new
  198. information will be loaded from the disk.
  199.  
  200. Every choice but 4, will lead you to a menu where you will be asked to choose
  201. the partition which should be modified. Just enter the partition's number
  202. and press enter. Every partition description can have up to four flags. The
  203. first flag can be either P,L or E. These letters stand for Primary, Logical
  204. and Extended partition respectively. The flag * shows that the specified
  205. partition can be resized. Only partitions with * can be resized. The flag #
  206. shows which partitions can be moved. The flag ! shows that a partition is
  207. incompatible with the program, therefore it cannot be moved or resized. All
  208. partitions can be moved, but this is not always safe. I have tried moving FAT
  209. and HPFS partitions successfully, but I cannot be sure for every partition
  210. type. If you decide to move any other partition type but FAT, you will be
  211. proceeding at your own risk. The Drive letter indicated for a partition is
  212. the one originally assigned by DOS. Usage of some software drivers, like
  213. DblSpace or Stacker might alter the original drive letters.
  214.  
  215. The user interface for resizing/moving partitions has been greatly simplified:
  216. appart from the use of graphics that make understanding the disk map easier,
  217. the most important functions of Partition Resizer are accessible through this
  218. screen. Using the Tab key, you can toggle between moving and resizing the
  219. currently selected partition. For advanced users, the space bar displays
  220. the extended partition of the disk and allows manipulation of its ends.
  221. By default, the extended partition is concealed, allowing the user to
  222. manipulate other partitions in a much simpler and effective way. Once
  223. finished, press enter to continue and accept the confirmation question.
  224.  
  225. The screen will now clear, and you will be asked whether you want to perform
  226. a surface test or not. This is not necessary if you know that your disk
  227. is free of defects or if you performed a surface test recently, since
  228. it will take some time (from several seconds to 15 minutes, depending on the
  229. size of the partition). If you are uncertain, perform the surface test, since
  230. bad sectors can be dangerous to your data. If the program finds any bad
  231. sectors, it will quit immediately. If the surface test concludes normally,
  232. the program will start performing the requested changes. This may take from
  233. a few seconds to a few hours, so be prepared. If the program is terminated
  234. abnormally, p.e. in case of a power shutdown, don't worry, you can always
  235. reboot and run the program again. It will continue exactly from the point it
  236. stopped. After it finishes, you may proceed with more changes, or exit the
  237. program, which will boot your machine.
  238.  
  239. Sounds easy? Well, it should be. But if you are confused, you better check out
  240. what's on the next section, just to get an idea about the whole partitioning
  241. system. If you still have questions, you can get help from friends, or contact
  242. me via my Internet addresses (see the end of this document). If you don't have
  243. access to Internet, you can send me a letter (postcard preferred) and I will
  244. try to help you as much as I can. Don't forget to tell me details about your
  245. system, your partitions, and send me a copy of the PRESIZER.LOG file.
  246.  
  247.  
  248.    2.3 Command Line Parameters
  249.  
  250. Partition Resizer's execution can be customized to suit your needs with the
  251. following command line parameters:
  252.  
  253. /drive:#    When scanning for available physical drives (hard disks),
  254.         Partition resizer will ignore all other drives except for the
  255.         one specified in this parameter. # stands for the drive
  256.         number (hard disk C: is number 0, D: is 1 and so on). For this
  257.         version of Partition Resizer, only one drive can be specified
  258.         each time the program runs.
  259. /ignsectsize    When the error message "Sector size other than 512 bytes"
  260.                 (Error 2) occurs, if you are certain that the sector size of
  261.                 your disk is definitely 512 bytes, use this switch to bypass
  262.                 the error. Be very careful though, because if the sector size
  263.                 is not 512 bytes, using this switch might have unpredictable
  264.                 results.
  265. /killrescue    If Partition Resizer was interrupted while resizing a
  266.         partition, the next time it runs it will ask you to resume the
  267.         operation. If you DO NOT WANT Partition Resizer to EVER resume
  268.         the interrupted operation, use this option to permanently
  269.         delete the rescue file and cleanup. This is a DANGEROUS
  270.         parameter, since, if the resizing process is not resumed after
  271.         abnormal interruption, the partition that was being processed
  272.         (and in extreme cases other partitions as well) may be
  273.         completely trashed.
  274. /newlog         Creates an empty log file. By default, new log entries are
  275.         appended to the existing log. This option allows to overwrite
  276.         the existing entries.
  277. /noboot        This switch forces the program to exit without rebooting
  278.         after changes to the partition structure and/or file systems
  279.         have been made. This is a DANGEROUS option, since if the
  280.         user attempts to use the modified partition(s) before the
  281.         machine is restarted, major damage can occur to the data.
  282. /readonly    This switch allows the user to execute the program and modify
  283.         partitions (resize or move them) without actually making any
  284.         change whatsoever. The switch directly disables the disk
  285.         write routine which is the only part of the program that can
  286.         perform actual modifications to the disk. Therefore, this
  287.         switch can be safely used for testing purposes, since all
  288.         other functionallity (logging, rescue file creation etc.) will
  289.         be available. Warning: because of slight changes to the rescue
  290.         system, which now uses disk writing to extend the counter
  291.         range, in some extreme cases the resumption process may not
  292.         work correctly if this switch is specified. This is because
  293.         the overflowing digits of the counter will be ignored.
  294.         This has no impact on the disk integrity, but it may give
  295.         false results (resumption may start at a step earlier than
  296.         expected) IF the program is interrupted and the process is
  297.         resumed.
  298. /textmode    If you have any problems using the graphical interface, use
  299.         this switch to work with an alternative (and similar to the
  300.         graphic) interface in text mode. The text mode interface
  301.         still provides full functionallity, but visual aid is less
  302.         accurate and informative.
  303.  
  304.  
  305. 3- Technical Matters
  306.  
  307.    3.1 The partition system
  308.  
  309. The partition system is one of the most important things on the disk
  310. subsystem. It is a standard beyond File Systems and Operating Systems.
  311. The partition structure looks very much like the DOS directory structure.
  312. The root directory here is the root sector, the first sector of the disk.
  313. When the machine boots, bios loads this sector at address 7C00:0000,
  314. and jumps there. As you understand, there is code written at the beginning
  315. of that sector. This code searches the primary partition list to see which
  316. one is bootable, then loads its first sector (the boot sector) at the same
  317. address (7C00:0000) and it jumps there. After that, it is the operating
  318. system that takes control.
  319. Let's see some more details. Here is a detailed map of the root partition
  320. sector (sector 1, head 0, cylinder 0) (you may often see it as MBR, master
  321. boot record):
  322.  
  323. Offset             Description
  324.  
  325. 0x000-0x1BD        Boot code
  326. 0x1BE-0x1CD        First Primary partition descriptor
  327. 0x1CE-0x1DD        Second Primary partition descriptor
  328. 0x1DE-0x1ED        Third Primary partition descriptor
  329. 0x1EE-0x1FD        Fourth Primary partition descriptor
  330. 0x1FE-0x1FF        System Signature word (0xAA55)
  331.  
  332. Boot code is the executable code that was described above. The partition
  333. descriptors have the following form:
  334.  
  335. Offset             Description
  336.  
  337. 0x0                Boot marking
  338. 0x1                Head                    \
  339. 0x2                Sector & Cylinder 8-9    >  Starting location
  340. 0x3                Cylinder 0-7            /
  341. 0x4                System Description
  342. 0x5                Head                    \
  343. 0x6                Sector & Cylinder 8-9    >  Ending location
  344. 0x7                Cylinder 0-7            /
  345. 0x8-0xB            Relative sector
  346. 0xC-0xF            Number of sectors in partition
  347.  
  348. Boot marking is a byte value, which can be either 0 or the drive number
  349. (0x80). If it is 0x80 then the partition is the active partition of the
  350. disk (boot partition), and that's where the system boots from. The next
  351. 3 bytes contain the head, cylinder and sector where the partition begins.
  352. Sector and cylinder are stored in two bytes. Bits 0-7 of the cylinder
  353. value are stored in the second byte, while bits 8-9 are stored at the
  354. high bits of the first byte. The sector value is stored at bits 0-5 of the
  355. first byte. So, the word is bitmapped like this:
  356.  
  357. FEDCBA98 76543210
  358. CCCCCCCC CCSSSSSS
  359. 76543210 98543210
  360.  
  361. where C are Cylinder bits (the number below shows which cylinder bit is
  362. which) and S are Sector bits. Right after is the system byte, which is
  363. the identification byte for the partition. A value of 0 means that the
  364. partition is not being used, while other values depend on the file system.
  365. DOS uses values 1,4 and 6 for FAT12, FAT16 and BigDOS partitions respectively.
  366. A value of 5 means Extended partition, which is explained later on.
  367. Next, there is the ending location (sector) of the partition, and later on,
  368. the relative sector value. This is a number that shows the position of the
  369. partition relative to the present sector. So, for primary partitions, it's
  370. the starting sector of the partition (Primary partitions are the partitions
  371. that are described in the root of the partition structure. As we will see
  372. later on, there are partition descriptors in other places on the disk as
  373. well, which are called logical drives). The last item of the descriptor,
  374. is the partition length (in sectors).
  375.  
  376. When the disk is operating in LBA mode, the CHS (cylinder-head-sector) values
  377. for starting and ending location are ignored. Mapping of the drive is not
  378. done in terms of CHS but with an absolute sector number. Thus, relative sector
  379. value and partition length are used for identifying the partition's territory
  380. on the disk. For disks greater than 8.4GB in size, CHS values are always
  381. invalid.
  382.  
  383. In the root sector, there is space for 4 descriptors. Right after them, there
  384. is a word value of 0xAA55, which marks the sector as system sector. This
  385. value exists on every sector of the partition structure (including boot
  386. sectors) and if it doesn't exist, then the structure may probably be damaged.
  387.  
  388. Now, concerning extended partitions, they are described as any other partition
  389. in the root sector, but their treatment is different. These partitions are
  390. specifically treated by the Operating Systems. They point to a sector which
  391. contains partition descriptors for other partitions and extended partitions,
  392. and so on. This is how we can have more than 4 partitions on a disk. Let's
  393. see a small graphic (sic) example:
  394.  
  395. MBR     1st Ext         2nd Ext         3rd Ext
  396.        -----------------------------------------------------
  397. 1:p    | 1:l           | 1:l           | 1:l               |
  398. 2:p    | 2:e-----------| 2:e-----------| 2:-               |
  399. 3:e----| 3:-           | 3:-           | 3:-               |
  400. 4:p    | 4:-           | 4:-           | 4:-               |
  401.        -----------------------------------------------------
  402.  
  403. In this example, we see a map of a partition structure. MBR stands for
  404. Master Boot Record (root sector) and 1st, 2nd and 3rd Ext stand for
  405. 1st, 2nd and 3rd Extended partition nodes. 'p' stands for primary partition,
  406. 'e' stands for extended partition and 'l' stands for logical drive.
  407. The 'e' partition in the MBR, is called main or root or primary extended
  408. partition. This is because the whole extended partition structure is depending
  409. on that partition. Now, the starting location of the primary extended
  410. partition points to the 1st extended partition. The space that the primary
  411. extended partition allocates, is reserved for logical drives. The 1st
  412. extended partition (and the rest as well) contain information about their
  413. respective logical drives, in a way identical to the MBR (described above),
  414. but without the boot code part. Every extended partition has 4 descriptors
  415. as well, but only the first two are used: the first one identifies the
  416. corresponding logical drive, and the second contains and extended partition
  417. entry pointing to the next logical drive in the partition chain. So, the
  418. partition structure is a linked list structure, which can be as long as we
  419. like. (Every extended partition description sector has the 0xAA55 signature
  420. at its end, to identify it as a system sector).
  421.  
  422. There are some geometry restrictions for partitions. Partitions must start at
  423. the beginning of a cylinder, and end at a cylinder's end. This is that
  424. starting location must always be Cyl: XXXX  Head: (0 or 1)  Sector 1 and the
  425. ending location must be Cyl: YYYY  Head: k-1  Sector l, where k is the number
  426. of heads of the physical disk, and l the number of sectors per track of the
  427. physical disk. Also, if you delete one of the middle logical drives, (p.e.
  428. the 2nd Ext.) then the previous extended partition will be connected directly
  429. to the next, replacing the link. Geometry restricions are also effective in
  430. disks that work with LBA translation.
  431.  
  432. If you want to see the whole thing yourself, you can make your primary DOS
  433. partition smaller, and create some new logical drives just to play with
  434. them. You can get much help from a commercial Disk Editor, and you can of
  435. course play with Partition Resizer.
  436.  
  437.  
  438.    3.2 The DOS (FAT16 and FAT12 only) filesystem structure
  439.  
  440. The MBR executable code will load the boot partition's boot record. This
  441. is the second step of the booting procedure. And this is where the whole
  442. thing differs from OS to OS. We will only look at DOS's proceedings for now,
  443. since the rest OS's are less documented and more complicated (although on the
  444. next version of Partition Resizer I'll manage to resize OS/2 partitions, and
  445. if I get lucky enough, why not NTFS...).
  446.  
  447. The DOS partition is rather simple: The first sector is the boot sector,
  448. right after there are two copies of the FAT (File Allocation Table), right
  449. then we have 32 sectors for the root directory, and finally we have clusters
  450. 0 and 1 (unused) and later on the rest of the clusters.
  451.  
  452. The Boot record, is an executable code block, which is loaded by the MBR,
  453. and it makes some preparation in order to load the IO.SYS file, which is
  454. the DOS kernel (if we can call it a kernel... ;-)). This is useless to us,
  455. since only the processor can understand machine code, but the boot sector
  456. also contains useful information. This information begins at offset 3 of
  457. the sector and contains the following:
  458.  
  459. Offset            Description
  460. 0x03-0x0A         OEM ID: This is a small string written by the formatter.
  461. 0x0B-0x0C         Bytes per sector: This is always 512 (it depends on the
  462.           physical disks characteristics). If you have a disk with
  463.           a different value, please don't hesitate to inform me.
  464.           Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE
  465.           OTHER THAN 512!
  466. 0x0D              Sectors per Cluster: The cluster is the basic block of
  467.           information on a FAT drive. A FAT drive cannot have more
  468.           than 65527 clusters. This size can limit the maximum size
  469.           a partition can reach after resizing.
  470. 0x0E-0x0F         Reserved sectors at beginning: This is normally 1, the
  471.           boot sector. After these sectors, begins the FAT area.
  472. 0x10              FAT copies: Number of FAT copies. Normally there
  473.           are two copies of FAT.
  474. 0x11-0x12         Root directory entries: This is normally 512. This shows
  475.           the maximum number of files and directories that root
  476.           directory can hold. This is because the root directory has
  477.           a constant length (512 entries * 32 bytes/entry /
  478.           512 bytes/sector = 32 sectors)
  479. 0x13-0x14         Total sectors on disk (small): If we have less than 65536
  480.           sectors in the partition, this value contains the number.
  481.           If it's more, then the number is stored in bytes 0x20-0x23.
  482.           This is an entry that was left from the old DOS versions,
  483.           when partitions could have up to 65536 sectors.
  484. 0x15              Media descriptor byte: This byte is always F8 for hard
  485.           disks.
  486. 0x16-0x17         Sectors per FAT: This shows how many sectors does each FAT
  487.           take up. This depends on how many clusters the partition
  488.           has, and what is the FAT type (12bit/16bit). This can be
  489.                   from 1 to 256 sectors.
  490. 0x18-0x19         Sectors per track: Same as the physical disk's sectors per
  491.           track value.
  492. 0x1A-0x1B         Sides: Same as the physical disk's head number.
  493. 0x1C-0x1F         Special hidden sectors: This is how many sectors exist
  494.           between the partition's description sector and the boot
  495.           sector. Usually one track.
  496. 0x20-0x23         Big total number of sectors: If we have more than 65536
  497.           sectors in the partition, their number is written here.
  498. 0x24-0x25         Physical drive number: This is the physical drive number
  499.           (c:0x80, d:0x81 etc.).
  500. 0x26              Extended boot record signature: This marks an extended
  501.           boot record. If it is 29, the disk was formatted by DOS
  502.           4.0 or later.
  503. 0x27-0x2A         Volume serial number: This is the partition's serial number.
  504. 0x2B-0x35         Volume label: This is the partition's label string.
  505. 0x36-0x3D         FS ID: This is a string that identifies a partition as
  506.           12bit FAT or 16bit FAT.
  507.  
  508. This is a detailed description of the boot record information. This will
  509. help you to understand more about the FAT file system.
  510.  
  511. The boot sector is the first sector of a DOS partition. The number of
  512. reserved sectors (which is normally 1) shows how many sectors we have before
  513. the FAT area. So in most cases, the first FAT sector is sector 2 of the
  514. partition (from now on, every sector number will be taken relatively from
  515. the beginning of the partition). The first FAT, who's length is given
  516. in the boot sector, contains entries that mark the partition's space
  517. allocation. Every file has a small descriptor of 32 bytes, which resides in
  518. its directory area (not in FAT). The directory area is itself a file, which
  519. is described in its parent directory, and so on until we reach root directory,
  520. which is a constant area in the partition (we'll see that later on). A word
  521. value in the file descriptor, tells DOS which is the file's first cluster.
  522. FAT consists of word values (or 12bit values if it is a 12bit FAT system),
  523. which begin from the first sector, and continue until the last one. Every
  524. value represents a cluster, which one is depending on the value's offset from
  525. the FAT's beginning. So, the 3rd word of the FAT stands for the 3rd cluster
  526. of the partition, and so on. So when DOS knows a file's first cluster, it's
  527. looking it up to find the value that is stored in the FAT's respective
  528. position. That value points to the next cluster of the file, and so on, until
  529. an EOF marking of 0xFFFF is found (0xFFF for 12bit FAT). Empty clusters are
  530. marked with 0 and bad clusters with 0xFFF7. This is how FAT works. Now, the
  531. first two positions of the FAT are reserved, and they have an identification
  532. code which is 0xFFFFFFF8 (0xFFFFF8 for 12bit FAT).
  533.  
  534. The rest FATs (2nd, 3rd etc.) are identical to the first one. They are
  535. exact copies of the first FAT, and they begin right after the end of the
  536. first FAT. Right after the last FAT, resides the root directory. This is
  537. normally 32 sectors long, and contains 32 byte entries which describe the
  538. root directory's files and directories. Right after the root directory,
  539. begins the first cluster (cluster 0) which is unused, and so is for cluster 1.
  540. Right after these two clusters, begins the user's space, where the files are
  541. stored.
  542.  
  543. This is the whole story about DOS's file system. This file system was designed
  544. to be fast (it's very easy to find the unallocated space) but it has certain
  545. disadvantages: One is the very large amount of unused space, which is caused
  546. by the use of clusters. For example, if you have a 340MB disk, you have to
  547. use 8192 bytes cluster size (16 sectors). This means that, if you write
  548. a file that is 1 or several bytes long, you will consume space of 8K. This
  549. could be resolved if we could use more than 65536 clusters in a DOS partition,
  550. which could mean a 20bit fat or more, in order to have clusters of 1 sector.
  551. Since this is not possible, there is another solution: Why should I have
  552. one partition with 8K cluster size, and not 2 partitions with 4K cluster size?
  553. The loss is lowered dramatically, and it would save many megs. This is not
  554. though always possible, since changing cluster size without loosing the
  555. existing data is quite complicated. I have decided not to add such
  556. functionality to the program, since the new Windows filesystem, FAT32,
  557. permanently solves the allocation problem. I strongly recommend the conversion
  558. of your existing FAT16 partitions into FAT32. This can be easily done with
  559. the use of the conversion utility provided by Microsoft and included in
  560. Windows 98 System tools collection.
  561.  
  562.  
  563.    3.3 The Windows FAT32 filesystem structure
  564.  
  565. The FAT32 filesystem is quite similar to the FAT16 filesystem. The following
  566. differences exist:
  567.  
  568. -FAT entries are now 32bit wide, allowing for a maximum of approximately 200
  569. milion clusters in a single partition (actually, each FAT entry is 28bit wide,
  570. the upper 4 bits are reserved for future use and must always be 0).
  571. -The boot sector's information has been changed (see the table below)
  572. -The root directory does not necessarily reside in the beginning of the drive
  573. and it can grow to any size desirable.
  574. -FAT mirroring can be disabled
  575.  
  576. In details, the boot sector entries are the following:
  577.  
  578. Offset            Description
  579. 0x03-0x0A         OEM ID: This is a small string written by the formatter.
  580. 0x0B-0x0C         Bytes per sector: This is always 512 (it depends on the
  581.           physical disks characteristics). If you have a disk with
  582.           a different value, please don't hesitate to inform me.
  583.           Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE
  584.           OTHER THAN 512!
  585. 0x0D              Sectors per Cluster: The cluster is the basic block of
  586.           information on a FAT drive. A FAT drive cannot have more
  587.           than 65527 clusters. This size can limit the maximum size
  588.           a partition can reach after resizing.
  589. 0x0E-0x0F         Reserved sectors at beginning: first FAT sector number
  590.           (0 based)
  591. 0x10              FAT copies: Number of FAT copies. Normally there
  592.           are two copies of FAT.
  593. 0x11-0x14         Reserved, must be 0.
  594. 0x15              Media descriptor byte: This byte is always F8 for hard
  595.           disks.
  596. 0x16-0x17         Reserved, must be 0
  597. 0x18-0x19         Sectors per track: Same as the physical disk's sectors per
  598.           track value.
  599. 0x1A-0x1B         Sides: Same as the physical disk's head number.
  600. 0x1C-0x1F         Special hidden sectors: This is how many sectors exist
  601.           between the partition's description sector and the boot
  602.           sector. Usually one track.
  603. 0x20-0x23         Big total number of sectors: If we have more than 65536
  604.           sectors in the partition, their number is written here.
  605. 0x24-0x27         Big Sectors per FAT value (old SPF value is now reserved).
  606. 0x28-0x29         Flags used for specifying FAT mirroring properties.
  607. 0x2A-0x2B         Major and minor version of the file system.
  608. 0x2C-0x2F         Root start: The first cluster (start) of the root directory.
  609. 0x30-0x31      File System sector number: offset of the file system sector
  610.           (see below).
  611. 0x32-0x33      Backup Boot Sector: offset of the backup copy of this
  612.           sector.
  613. 0x34-0x3F      Reserved.
  614. 0x40              Physical drive number: This is the physical drive number
  615.           (c:0x80, d:0x81 etc.).
  616. 0x41          Reserved.
  617. 0x42              Extended boot record signature: This marks an extended
  618.           boot record. If it is 29, the disk was formatted by DOS
  619.           4.0 or later.
  620. 0x43-0x46         Volume serial number: This is the partition's serial number.
  621. 0x47-0x51         Volume label: This is the partition's label string.
  622. 0x52-0x59         FS ID: This is a string that identifies a partition as
  623.           FAT32.
  624.  
  625. After this boot sector, the File System Sector exists, containing the
  626. following information:
  627.  
  628. 0x1E8-0x1EB      Free cluster count: contains the number of free clusters
  629.           in the drive (used to speed up free space calculation). If
  630.           it is -1 the value is recalculated.
  631. 0x1EC-0x1EF      First free cluster: number of the first available cluster
  632.           in the partition.
  633.  
  634. I will not go into more detailed explaination of the FAT32 file system. For
  635. more information, please visit the Microsoft Developers Library at
  636. http://www.microsoft.com/msdn and go to SDK Documentation - Platform SDK -
  637. Windows Base Services - Windows 95 Features - Windows 95 Reference -
  638. FAT32 API Reference - Structures.
  639.  
  640.  
  641. 4- Partitioning Techniques
  642.  
  643.    4.1 Deciding what you want
  644.  
  645. Well, OK, you've got the program. But now what happens? Where will you
  646. create the proper space for a new partition? And which partition is the one
  647. you want to shrink or grow? How should you place the partitions in the
  648. empty space to order them as you like? How will you grow a partition which
  649. refuses to grow more?
  650.  
  651. First of all, you have to decide what you want. Take a look at the partition
  652. list that FDISK or Partition Resizer provide you. Decide which partitions
  653. you need to resize. You may recognise them by their size, drive letter or
  654. serial numbers. Then you'll have to think what the new sizes will be. Remember
  655. that what's inside the extended partition cannot get out of it, and what's
  656. outside cannot get inside either.
  657.  
  658. Now, here are some useful techniques to use in certain situations. Just take
  659. a look to see if they meet your needs.
  660.  
  661.  
  662.    4.2 Merging many small partitions into a larger one
  663.  
  664. Sometimes, you get your disk divided into three or four partitions, which
  665. is not a useful thing. Until now, the only solution was to backup all
  666. your data, delete the whole partition structure, and then create a large
  667. partition to put your data inside. Partition Resizer can resolve the
  668. problem without any backing up. It's much faster and easier. Just do the
  669. following:
  670.  
  671. a. Decide which partition will be the one to remain. Normally, you should
  672. choose a primary partition. The problem is if it can grow enough. Decide
  673. what is the size the partition will finally grow to, and check if your
  674. primary partition can grow to that size. If it can't, go to step b, otherwise
  675. read step c.
  676.  
  677. b. If you want to create a partition that can grow enough for your needs,
  678. you will have to empty your primary partition. To do this, you have to
  679. shrink it to its minimum, while growing a logical drive. This can be done by
  680. shrinking the primary partition, expanding downwards the extended partition,
  681. moving the first logical drive to the beginning of the extended partition,
  682. and growing it to the max. Then, exit the program, move as much files as you
  683. can from the primary partition to the grown logical drive, defrag the
  684. primary partition, and repeat step b until the primary partition is empty.
  685. When you empty it, use the program to change its cluster size that matches
  686. your needs. You can provide the program with the desired size, which is the
  687. size you want the partition to have when you finish the whole process.
  688. Partition Resizer will then suggest you a cluster size to apply to the
  689. partition, which is the optimum size for the given desired partition size.
  690. If this was your boot partition, you will have to make it a system partition
  691. again, so run SYS to do that.
  692.  
  693. c. Now that your primary partition is able to grow enough, start moving
  694. data into it. Try to get data from small partitions, so that you can
  695. finish with them early and get rid of them. If you filled up the primary
  696. partition and there's still data in the partition which you are emptying,
  697. move data from the emptying partition to other partitions, in order to
  698. empty it faster. When the partition is empty, you can delete it with FDISK.
  699. If you cannot empty it, then defrag it, shrink it to its minimum, and move
  700. it to the end of the empty space created, grow the previous partition to
  701. reclaim the empty space created, exit the program, and move the rest of the
  702. data remaining into the grown partition. Repeat this until you empty the
  703. partition, and then delete it with FDISK.
  704.  
  705. d. One of the small partitions is now deleted. You can now move all the
  706. other logical drives to the end of the empty space, and resize the extended
  707. partition in order to make more space to grow the primary partition. Then
  708. choose another partition and repeat step c until you empty and delete all the
  709. logical drives. With the last one, you can delete the extended partition
  710. too. And presto! You can now grow the primary partition to fill all the
  711. empty space in the disk.
  712.  
  713.  
  714.    4.3 Splitting a partition in two
  715.  
  716. This technique is much alike the previous one. Suppose you have one primary
  717. partition, and you want to split it in two partitions. This is faster and
  718. easier than the previous procedure, just do the following:
  719.  
  720. a. Defrag the primary partition, and then shrink it to the minimum. This way,
  721. you will create empty space for the new partition.
  722.  
  723. b. Using FDISK create an extended partition, and then a logical drive in it.
  724. Format the logical drive, and run Partition Resizer. You will now have to
  725. decide the final size of the new partition, in order to change its cluster
  726. size while it is still empty. When you decide the final size, choose the
  727. third option of Partition Resizer's main menu, and give as desired size the
  728. size you decided. The program will suggest you a cluster size that is optimum
  729. for the partition, and you should apply that size.
  730.  
  731. c. When you finish creating and modifying the new partition, exit the program,
  732. and move the data you want in the new partition. Then, shrink the primary
  733. partition again (defraging is necessary here) grow the logical drive to the
  734. maximum. Repeat this step, until you reach the desired size.
  735.  
  736.  
  737.    4.4 Playing with partitions' sizes and positions
  738.  
  739. And now, some general advice about partition resizing:
  740.  
  741. a. When shrinking a partition, always defrag it first. This will leave
  742. space at the end of the partition, which will be freed by the program. The
  743. less space you have at the end of the partition, the less the shrinking will
  744. be. When defraging take special care for the unmovable files: They must be
  745. moved too, so change their attributes before defraging the disk. System
  746. files are a special case of unmovable files. You must be extra careful with
  747. these. Check the TROUBLE.DOC to see more info about the system files.
  748.  
  749. b. Although Partition Resizer can move primary partitions, you will rarely
  750. need to do this. You should always leave your DOS primary partitions in their
  751. original place, unless you absolutely need to move them. This will not harm
  752. the partition, but it might leave unused space before the primary partition
  753. which will never be used by DOS's FDISK. Warning: if you move a primary DOS
  754. partition, you might not be able to boot from that partition!
  755.  
  756. c. If you want to install a new operating system, you may have to delete
  757. much of your data in the DOS partition, since you cannot move that data in
  758. the new partition. So, you will only have to shrink your DOS partition once.
  759.  
  760. d. Always follow the safety rules described in README.1ST. Playing with your
  761. data can be REALLY dangerous sometimes, so be very careful.
  762.  
  763.  
  764.    4.5 Lack of features and possible workarounds
  765.  
  766. Partition Resizer required a lot of time for its development and the
  767. development of its upgrades. Time which was spent solely by me, and which is
  768. of course valuable. I never regret the time I spent on this project, and I
  769. feel that my efforts have been paid off by the success of the program in an
  770. international level.
  771.  
  772. There are though some features that Partition Resizer always lacked, and will
  773. probably continue to lack, because I believe that they are not necessary or
  774. workarounds can be used instead, while the time and effort they require for
  775. development is more than what I can invest (or am willing to invest). These
  776. features and possible workarounds are the following:
  777.  
  778. Problem:     Partition Resizer does not resize non-FAT partitions.
  779. Workaround:    Nothing I can think of... another program maybe?
  780.  
  781. Problem:    Partition Resizer does not change the cluster size in a
  782.         non-destructive way.
  783. Workaround:    Several workarounds exist. The best in my opinion, that is
  784.         of course if it can be applied, is to change the filesystem
  785.         to FAT32. This will create partitions with minimal cluster
  786.         sizes (4K) and practically unlimited maximum size. If FAT32
  787.         is not available, then try creating a new partition of the
  788.         desired cluster size, and move the data in there (see
  789.         PRESIZER.FAQ for a more detailed description of the process)
  790.  
  791. Problem:    Partition Resizer does not perform creation or deletion
  792.         of partitions.
  793. Workaround:    FDISK does. Please use it.
  794.  
  795. Problem:    Partition Resizer's user interface sucks.
  796. Workaround:     Pretend you like the user interface.
  797.  
  798.  
  799. 5- Credits and addresses
  800.  
  801. There used to be a huge list of thanksgivings here, but I decided that it
  802. will take ages to update it (especially after 3 years). So I will briefly
  803. (but not less intensively) thank all of the people who helped the creation
  804. and continuous development of this program, with their suggestions, their
  805. feedback, and most of all their support that comes from the appreciation of
  806. my work.
  807.  
  808. I also thank you, for spending the time to read this document and for
  809. using my program. I hope that the technical info included in here will
  810. seriously help many of you to create your own programs. If you find this
  811. program useful, you can always send me a postcard to the following address:
  812.  
  813.     John Lagonikas
  814.     17 Lycourgou Str.
  815.     16675 Glyfada
  816.     ATHENS, GREECE
  817.  
  818. Since the e-mail flow concerning the program is always increasing, and reached
  819. a peak of several messages per day that had to be answered in detail, I would
  820. kindly request that you think twice before asking for advice or information.
  821. So, please, before sending the message, take a look at PRESIZER.FAQ to see if
  822. the answer to your questions (or your prayers) is in there. Please try to find
  823. some different passive sources (web pages, documentation, books etc.) that
  824. might help solving your problem. If all else fails, try contacting me at the
  825. address:
  826.  
  827.     zeleps@usa.net
  828.  
  829. Commentary e-mail is welcome, but it will probably not be answered.
  830.  
  831. The official home page of Partition Resizer is currently (18/12/98) located
  832. at:
  833.  
  834.     http://members.xoom.com/Zeleps
  835.  
  836. If you cannot find the page at this location for any reason, you can perform
  837. a Web search with the keywords "Partition Resizer Zeleps" to locate it.
  838.  
  839.  
  840. Thank you again for reading this document and for using Partition Resizer!
  841.  
  842.                    ------||------
  843.